package create_pattern.singleton_pattern;

/**
 * @author fly
 * @data 2022-04-08
 * 单利模式-静态内部内模式
 */
public class InnerStaticSingleton {
    private static InnerStaticSingleton innerStaticSingleton = null;

    /**
     * 构造方法私有化
     */
    private InnerStaticSingleton() {
    }

    /**
     * 提供获取对象方法，获取静态内部内初始化对象
     * @return
     */
    public static InnerStaticSingleton getInnerStaticSingleton() {
        return Inner.inner;
    }

    /**
     * 静态内部类 构建对象
     */
    private static class Inner {
        private final static InnerStaticSingleton inner = new InnerStaticSingleton();
    }
}